package org.lyc.lanqiao.bank;

import java.util.Scanner;

/**
 * 单词分析
 * 判断字符串中出现最多的字母和它出现的次数
 * https://www.lanqiao.cn/problems/504/learning/?page=1&first_category_id=1&second_category_id=3&sort=students_count&asc=0
 *
 * @author Liu Yicong
 * @date 2024/1/27
 */
public class CWordsAnal {

	public static void main(String[] args) {
		//输入数据
		Scanner sc = new Scanner(System.in);
		//输入的字符串
		String input = sc.nextLine();
		sc.close();
		char[] charArray = input.toCharArray();
		int maxNum = 0;
		char maxChar = 0;
		for (int i = 0; i < charArray.length; i++) {
			char tempChar = charArray[i];
			int tempNum = 0;
			for (int j = i; j < charArray.length; j++) {
				if (tempChar == charArray[j]) {
					tempNum++;
				}
			}
			if (tempNum > maxNum) {
				maxChar = tempChar;
				maxNum = tempNum;
			}
			if (tempNum == maxNum) {
				if (tempChar < maxChar) {
					maxChar = tempChar;
					maxNum = tempNum;
				}
			}

		}
		System.out.println(maxChar);
		System.out.println(maxNum);
	}
}
